package business.impl;

import java.util.List;

import model.AnnexB;
import model.TPractice;
import model.VPratice;
import business.basic.iHibBaseDAO;
import business.basic.iHibBaseDAOImpl;
import business.dao.PracticeDao;

public class PractiveDaoImpl implements PracticeDao {
	
	iHibBaseDAO bdao = null;
	public void setBdao (iHibBaseDAO bdao){
		this.bdao=bdao;
		
	}

	@Override
	public TPractice getstuexpeById(int id) {
		TPractice title = (TPractice) bdao.findById(TPractice.class,id);
		return title;
	}

	@Override
	public int addStuexpe(TPractice model) {
		Object obj = bdao.insert(model);
		if (obj == null) {
			return 0;
		}
		return 1;
	}

	@Override
	public boolean upStuexpe(TPractice model) {
		return bdao.update(model);
	}

	@Override
	public boolean delStuexpe(int id) {
		return bdao.delete(TPractice.class, id);
	}

	@Override
	public List<VPratice> getStuexpes(int stuid) {
		String sql = " from VPratice where stuinfoid =   ?";
		Object[] para = {stuid};
		List<VPratice> modl = bdao.select(sql, para);
		return modl;
	}

}
